package cn.dz.dao.impl;

import cn.dz.dao.UserDao;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

/**
 * @ClassName UserDaoImpl
 * @package: cn.dz.dao.impl
 * @Description UserDaoImpl
 * @Author dz
 * @Date 2025/2/10 15:29
 * @Version 1.0
 **/
//@Component(value = "userDao")
@Repository(value = "userDao")
@Scope("singleton")
@Lazy(value = false)
//@Component //未指定名默认为首字母小写的bean名称
public class UserDaoImpl implements UserDao {

    @PostConstruct
    public void init() {
        System.out.println("userDao的初始化方法");
    }

    @PreDestroy
    public void destroy() {
        System.out.println("userDao的销毁方法");
    }

    @Value("zhangsan") // 根据
    private String username;
    @Override
    public void show() {
        System.out.println();
    }
}
